<?php

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateSalesmanHistoryTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('salesman_history', function (Blueprint $table) {
            $table->increments('id');
            $table->integer('salesmanid')->comment('地推人员ID');
            $table->integer('cityid')->comment('城市id');
            $table->string('name', 64)->comment('名称');
            $table->integer('registernum')->default(0)->comment('注册数');
            $table->decimal('registermoney', 16, 2)->default(0.00)->comment('注册佣金');
            $table->integer('ordernum')->default(0)->comment('订单数');
            $table->integer('ordervalidnum')->default(0)->comment('有效订单数');
            $table->decimal('ordermoney', 16, 2)->default(0.00)->comment('订单佣金');
            $table->decimal('ordertotalamount', 16, 2)->default(0.00)->comment('订单总金额');
            $table->integer('rechargenum')->default(0)->comment('充值数');
            $table->integer('rechargevalidnum')->default(0)->comment('有效充值数');
            $table->decimal('rechargemoney', 16, 2)->default(0.00)->comment('充值金额');
            $table->decimal('rechargetotalamount', 16, 2)->default(0.00)->comment('充值总金额');
            $table->decimal('totalmoney', 16, 2)->default(0.00)->comment('总佣金');
            $table->integer('salesmansetid')->default(0)->comment('地推设置id');
            $table->integer('adminid')->default(0)->comment('操作员id');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::drop('salesman_info');
    }
}
